<template>
  <div>
    <el-card v-loading="loading">
      <div v-for="(item,index) in lineList" :key="index" class="line-item flex jc-between">
        <a @click="goPoemItem(item.pid,item.ptitle)">{{ item.fcontent }}</a>
        <div>
          —— <a @click="goAuthorItem(item.aid,item.aname)">{{ item.aname }}</a>
          <a
              @click="goPoemItem(item.pid,item.ptitle)"> 《{{ item.ptitle}}》</a>
        </div>
        <el-divider></el-divider>
      </div>
    </el-card>
  </div>
</template>

<script>
import router from '@/router'
import {reqGetLineAll} from '@/API/modules/poem'

export default {
  name: "LineList",
  data() {
    return {
      lineList: [],
      loading:true
    }
  },
  methods: {
    goPoemItem(pid, bread) {
      //在出发地印上目的地的名字
      this.$route.meta.toBreadName = bread;
      router.push(`/poemItem/${pid}`)
    },
    goAuthorItem(aid, bread) {
      //在出发地印上目的地的名字
      this.$route.meta.toBreadName = bread;
      router.push(`/authorItem/${aid}`)
    },
    async getLineAll() {
      let result = await reqGetLineAll()
      if (result.status == 200) {
        this.lineList = result.data.data.splice(0,9)
        this.loading = false
      }
    }
  },
  mounted() {
    this.getLineAll()
  }
}
</script>

<style lang="scss" scoped>
.line-item {
  margin: 0 24px;
}
</style>